package com.superman.util;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class CurrentPayment {
    public static double getCurrentPayment(String start_date, String current_date, double rent){
    SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
    format.setLenient(false);
    long days = 0;
    try {
        Date date1 = format.parse(start_date);
        Date date2 = format.parse(current_date);
        days=(date2.getTime() - date1.getTime())/(1000*60*60*24) + 1;//不足一天按一天计算
    } catch (ParseException e) {
        e.printStackTrace();
    }finally {
        return rent*days;
    }
}
}
